package cn.com.fuhuitong.main.mine.adapter

import android.annotation.SuppressLint
import android.content.Context
import android.view.View
import cn.com.fuhuitong.R
import cn.com.fuhuitong.base.BaseDelegateAdapter
import cn.com.fuhuitong.main.ItemViewType
import cn.com.fuhuitong.main.mine.entity.ShareList
import cn.com.fuhuitong.main.mine.entity.WithdrawListEntity
import com.alibaba.android.vlayout.LayoutHelper
import com.blankj.utilcode.util.TimeUtils
import kotlinx.android.synthetic.main.item_withdraw_list.view.*

class WithdrawListAdapter(
    private val mContext: Context, private val mHelper: LayoutHelper
) : BaseDelegateAdapter<WithdrawListEntity>(
    mContext = mContext,
    mHelper = mHelper,
    mLayoutId = R.layout.item_withdraw_list,
    mItemViewType = ItemViewType.WITHDRAW_LIST
) {
    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(itemView: View, position: Int, itemData: WithdrawListEntity) {
        super.onBindViewHolder(itemView, position, itemData)
        itemView.item_withdraw_list_time.text = TimeUtils.millis2String((itemData.createtime * 1000))
        itemView.item_withdraw_list_price.text = "-${itemData.price}"
        //状态:1=待审核,2=审核成功,3=审核失败
        itemView.item_withdraw_list_state.text = when (itemData.status) {
            1 -> "审核中"
            2 -> "提现成功"
            else -> "提现失败"
        }
        itemView.item_withdraw_list_state.isSelected = when (itemData.status) {
            1 -> false
            2 -> true
            else -> false
        }
    }
}